const { commentsModel } = require('../models/commentsModel');



//新增评论
module.exports.addComment = async function ({ usersId, foodsId, content }) {
    console.log(usersId, foodsId, content);

    const data = await commentsModel.create({ usersId, foodsId, content });
    console.log(data);
    return data;
}


//获取评论
module.exports.getComment = async function ({ foodsId }) {
    const data = await commentsModel.find({ foodsId }).populate('usersId');
    console.log(data);
    return data;
}
